

import os

# # 修改文件夹名
# path_image = 'E:\Works\Hisi_codes\SLRDataset_isolate\color_img\\001'
# dir_list = os.listdir(path_image)
# for i in range(len(dir_list)):
#     old_name = dir_list[i]
#     new_name = old_name[0:-7]
#     os.rename(os.path.join(path_image, old_name), os.path.join(path_image, new_name))

#     print(old_name, "  -->  ", new_name)

# 修改文件名
path_image = 'E:\Works\Hisi_codes\SLRDataset_isolate\color_img\\001'
dir_list = os.listdir(path_image)
for i in range(len(dir_list)):
    # old_name = dir_list[i]
    # new_name = old_name[0:-7]
    # os.rename(os.path.join(path_image, old_name), os.path.join(path_image, new_name))

    # print(old_name, "  -->  ", new_name)
    print(dir_list[i])
    dir_name = dir_list[i]

    videos_list = os.listdir(os.path.join(path_image, dir_name))

    for j in range(len(videos_list)):
        # print()
        old_name = videos_list[j]
        new_name = "{:03d}.jpg".format(j)
        os.rename(os.path.join(path_image, dir_name, old_name), os.path.join(path_image, dir_name, new_name))
